<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<img id="hl" src="img/off.gif"><br>
<div class="cls">热血传奇</div>
<div class="cls">无敌剑圣</div>

<input type="checkbox" name="hobby">电影
<input type="checkbox" name="hobby">旅游
<input type="checkbox" name="hobby">游戏
</body>
<script>
    /*document对象中提供的获取元素对象的函数*/
    /*    //1.1根据元素id获取
        var img = document.getElementById('hl');
        alert(img);
        //1.2根据标签获取
        var divs = document.getElementsByTagName('div');
        for (let i = 0; i < divs.length; i++) {
            alert(divs[i]);
        }
        //1.3根据name属性获取
        var ins = document.getElementsByName('hobby');
        for (let i = 0; i < divs.length; i++) {
            alert(ins[i]);
        }
        //1.4根据class属性
        var clss = document.getElementsByClassName('cls');
        for (let i = 0; i < divs.length; i++) {
            alert(clss[i]);
        }*/
    //2.查询参考手册,属性方法
    var divs = document.getElementsByClassName('cls');
    var div1 = divs[0];
    var div2 = divs[1];
    div1.innerHTML = "传奇热血,是兄弟就来砍我吧!";
    div2.innerText="我是渣渣辉,期待你的加入!";
</script>
</html>